package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.domain.db.Announcement;
import com.itheima.domain.vo.PageBeanVo;
import com.itheima.mapper.AnnouncementMapper;
import com.itheima.service.db.AnnouncementService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class AnnouncementServiceImpl implements AnnouncementService {
    @Autowired
    private AnnouncementMapper announcementMapper;
    @Override
    public PageBeanVo findAnnouncement(Integer pageNum, Integer pageSize) {
        System.out.println("进入findAnnouncement");
        IPage<Announcement> page = new Page<>(pageNum,pageSize);
        IPage<Announcement> page1 = announcementMapper.selectPage(page, null);
        List<Announcement> announcementList = page1.getRecords();
        System.out.println(announcementList);
        return new PageBeanVo(pageNum,pageSize,Long.valueOf(announcementList.size()),announcementList);
    }
}
